package com.balance.anole.admin.service;

import java.util.List;
import java.util.Map;

import com.balance.anole.admin.to.AgentTO;
import com.balance.anole.admin.to.DepartmentTO;
import com.balance.anole.admin.to.GroupNavigateTO;
import com.balance.anole.admin.to.LoginUserTO;
import com.balance.anole.admin.to.ShopTO;
import com.balance.anole.admin.to.StaffInfoTO;
import com.balance.anole.admin.to.SupplierTO;
import com.balance.anole.admin.to.WarehouseTO;
import com.balance.anole.common.to.CodeLookTO;
import com.balance.anole.common.to.PermissionTypeTO;


public interface AdminService {
	
	/**
	 * List all Staffs
	 *
	 * @return
	 */
	public List<StaffInfoTO> listAllStaffs();
	
	/**
	 * Insert staff.
	 *
	 * @param staffInfoTO
	 */
	public void insertOrupdateStaffInfoTO(StaffInfoTO staffInfoTO);
	
	/**
	 * Get staff by staffId.
	 *
	 * @param staffId
	 * @return
	 */
	public StaffInfoTO getStaffInfoByStaffId(String staffId);
	
	/**
	 * Get all staff by type.
	 *
	 * @param staffTypeId
	 * @return
	 */
	public List<StaffInfoTO> getStaffByStaffRole(CodeLookTO role);
	
	/**
	 * Get staff by id.
	 *
	 * @param id
	 * @return StaffInfoTO
	 */
	public StaffInfoTO getStaffInfoTO(Integer id);
	
	
	/**
	 * @param ids
	 */
	public void deleteLogicStaffInfo(Integer[] ids);
	
	/**
	 * Insert loginUser.
	 *
	 * @param loginUserTO
	 */
	public void insertOrupdateLoginUserTO(LoginUserTO loginUserTO);
	
	/**
	 * Check if the login is correct. Return the staff info with internal id for client check.
	 *
	 * @param loginUser
	 * @return
	 */
	public LoginUserTO login(LoginUserTO loginUser);
	
	/**
	 * Get LoginUser using id. Should only return one record since id
	 * is the primary key.
	 *
	 * @param id
	 * @return
	 */
	public LoginUserTO getLoginUserTO(Integer id);
	
	/**
	 * Get LoginUser by staffId
	 *
	 * @param staffId
	 * @return
	 */
	public LoginUserTO getLoginUserTO(String staffId);

	/**
	 * Insert department.
	 *
	 * @param departmentTO
	 */
	public void insertOrupdateDepartmentTO(DepartmentTO departmentTO);
	
	/**
	 * @param departmentId
	 * @return
	 */
	public DepartmentTO getDepartmentTOByDepartmentId(String departmentId);
	
	
	/**
	 * @param id
	 * @return
	 */
	public DepartmentTO getDepartmentTO(Integer id);

	/**
	 * Insert agentTO.
	 *
	 * @param agentTO
	 */
	public void insertOrupdateAgentTO(AgentTO agentTO);
	
	/**
	 * Get agents by agent type.
	 *
	 * @param agentTypeId
	 * @return
	 */
	public List<AgentTO> getAgentsByAgentType(String agentTypeId);

	/**
	 * Get agents by agent type.
	 *
	 * @param agentTypeId
	 * @return
	 */
	public List<AgentTO> getAgentsByAgentRole(CodeLookTO role);

	/**
	 * List all Agents
	 *
	 * @return
	 */
	public List<AgentTO> listAllAgents();
	
	/**
	 * Get AgentTO by AgentId
	 * @param agentId
	 * @return
	 */
	public AgentTO getAgentTOByAgentId(String agentId);
	
	/**
	 * Get AgentTO by id
	 * @param id
	 * @return AgentTO
	 */	
	public AgentTO getAgentTO(Integer id);
	
	/**
	 * Get next agent id
	 * @param agentType, agentRole
	 * @return agentId
	 */		
	public String getNextAgentId(Map<String,Object> paramMap);	
	
	/**
	 * Get root agent
	 * @param id of child agent
	 * @return AgentTO
	 */	
	public AgentTO getRootAgentTOById(Integer id);
	
	public List<AgentTO> getSubAgents(AgentTO curAgent, boolean containsSelf);
	
	/**
	 * Delete logic agent in db
	 * @param id of agents
	 * @return null
	 */		
	public void deleteLogicAgentInfo(Integer[] ids);
	/**
	 * Get AgentTO list for pagination
	 * @param id
	 * @return AgentTO
	 */		
	/**
	 * @param shop
	 */
	public void saveOrUpdateShop(ShopTO shop);

	/**
	 * Get warehouses by given stock-in type.
	 *
	 * @param selector
	 * @return
	 */
	public List<WarehouseTO> getWarehousesByStockInType(CodeLookTO selector);
	
	
	/**
	 * Get warehouses by id.
	 *
	 * @param id
	 * @return
	 */
	public WarehouseTO getWarehouseTO(Integer id);
	
	/**
	 * Get warehouses by warehouseId
	 *
	 * @param warehouseId
	 * @return List<WarehouseTO>
	 */
	public List<WarehouseTO> getWarehouseTOByWarehouseId(String warehouseId);	
	
	/**
	 * Create or update the warehouse.
	 * 
	 * @param warehouseTO
	 */
	public void insertOrUpdateWarehouseTO(WarehouseTO warehouseTO);
	
	/**
	 * Create or update the supplier.
	 * 
	 * @param supplierTO
	 */	
	public void insertOrUpdateSupplierTO(SupplierTO supplierTO);	
	
	/**
	 * get supplier. 
	 * 
	 * @param id
	 */	
	public SupplierTO getSupplierTO(Integer id);
	
	/**
	 * generate next supplierId of supplier. 
	 * 
	 * @param null
	 */		
	public String getNextSupplierId();

	/*======================== GroupNavigate manage ========================*/
	public void insertOrupdateGroupNavigateTO(GroupNavigateTO grpNav);
	
	public GroupNavigateTO getGroupNavigate(Integer id);
	
	public boolean existsGroupNavigate(Integer grpId, String url, String action);
}
